#include "stdio.h"
#include "fcntl.h"
#include "stdlib.h"
#include "string.h"
#include <sys/ioctl.h>


#define HELLO_MAGIC 'k'
#define S_R    (0x0a)	//_IO(HELLO_MAGIC,0x1a)
#define S_W    (0x0c)	//_IO(HELLO_MAGIC,0x1b)

int main(void)
{
	int fd=0;
	char wbuf[] = "abcd132";
	char rbuf[256];
	int nr;

	fd = open("/dev/my_misc", O_RDWR);

	if(fd<0){
		printf("[APP] open error! fd=%d\n",fd);
		return 1;
	}

	write(fd, wbuf, strlen(wbuf));

	memset(rbuf, '\0', 256);
	read(fd, rbuf, strlen(wbuf));
	printf("rbuf: %s\n", rbuf);

	int a = 'B';
	ioctl(fd, S_W, &a);
	printf("a=%d\n", a);

	// for(nr = 0; nr < (S_3+1); ++nr) {
	// 	/* code */
	// }

	return 0;
}

